<!--
 * @Author: Meow
 * @Date: 2019-10-09 09:18:57
 * @LastEditors: Civet
 * @LastEditTime: 2019-10-22 16:30:50
 * @Description: 
 -->
<template>
  <div id="maintenance">
    <div class="container">
      <div class="view">
        <div class="aside">
          <div class="aside_top">
            <el-input
              class="filterInput"
              placeholder="目录名称"
              v-model="filterText"
              @keyup.enter.native="catalogSearch"
            ></el-input>
            <el-button type="primary" @click="catalogSearch">搜索</el-button>
          </div>
          <div class="aside_tree">
            <el-scrollbar :native="false" tag="section" class="el-scroll">
              <el-tree
                lazy
                :data="treeData"
                :props="treeProps"
                :highlight-current="true"
                :filter-node-method="treefilter"
                :load="loadNode"
                @node-click="nodeClick"
                ref="tree"
              ></el-tree>
            </el-scrollbar>
          </div>
          <div class="aside_bottom">
            <!-- <el-checkbox v-model="noRelease">未发布资源</el-checkbox>
            <el-checkbox v-model="isRelease">已发布资源</el-checkbox>-->
          </div>
        </div>
        <el-divider direction="vertical"></el-divider>
        <div class="right">
          <div class="container">
            <div class="view">
              <component
                :is="inComponent"
                :showtableData="showtableData"
                :showTableList="showTableList"
                :systemForm="systemForm"
                :sysForm="sysForm"
                :sysDialog="sysDialog"
                :sysfindAllSysData="sysfindAllSysData"
                :findOrgCatalogTreeData="findOrgCatalogTreeData"
                :QueryDictInfoByTypeData="QueryDictInfoByTypeData"
                :sysexchangeSystemData="sysexchangeSystemData"
                :queryLabelTree="queryLabelTree"
                :infoCollectData="infoCollectData"
                :infotableData="infotableData"
                :editInfoForm="editInfoForm"
                :baseInfoDialog="baseInfoDialog"
                :ExtractionMethodData="ExtractionMethodData"
                :DatabaseTypeData="DatabaseTypeData"
                :dbVersion="dbVersion"
                :driveData="driveData"
                :exchangeSystemData="exchangeSystemData"
                :findAllSysData="findAllSysData"
                :infoOptions="infoOptions"
                @sysEdit="sysEdit"
                @sysClose="sysClose"
                @sysCancel="sysCancel"
                @sysKeep="sysKeep"
                @baseInfoEdit="baseInfoEdit"
                @baseInfoClose="baseInfoClose"
                @baseInfoCancel="baseInfoCancel"
                @baseInfoKeep="baseInfoKeep"
                @baseSearchDbVersion="baseSearchDbVersion"
                @baseSearchDbDrive="baseSearchDbDrive"
              ></component>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import ShowTable from "./components/ShowTable";
import InforCollect from "./components/InforCollect";
import SpaceForm from "./components/SpaceForm";
import SystemForm from "./components/SystemForm";

export default {
  components: {
    ShowTable,
    InforCollect,
    SpaceForm,
    SystemForm
  },
  name: "maintenance",
  watch: {
    componentType(val) {
      this.inComponent = val;
    }
  },
  props: {
    Loading: {
      type: Boolean,
      default: false
    },
    treeProps: {
      type: Object,
      default: () => {
        return {};
      }
    },
    treeData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    componentType: {
      type: String,
      default: ""
    },
    // --------------------------ShowTable组件属性
    showtableData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    showTableList: {
      type: Array,
      default: () => {
        return [];
      }
    },
    // --------------------------SystemForm
    systemForm: {
      type: Object,
      default: () => {
        return {};
      }
    },
    sysDialog: {
      type: Boolean,
      default: false
    },
    sysForm: {
      type: Object,
      default: () => {
        return {};
      }
    },
    // -----------------------------InfoCollect

    infotableData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    infoCollectData: {
      type: Object,
      default: () => {
        return {};
      }
    },
    baseInfoDialog: {
      type: Boolean,
      default: false
    },
    editInfoForm: {
      type: Object,
      default: () => {
        return {};
      }
    },
    ExtractionMethodData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    DatabaseTypeData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    dbVersion: {
      type: Array,
      default: () => {
        return [];
      }
    },
    driveData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    exchangeSystemData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    findAllSysData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    infoOptions: {
      type: Array,
      default: () => {
        return [];
      }
    },
    // -----------------------------SystemForm
    sysfindAllSysData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    findOrgCatalogTreeData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    QueryDictInfoByTypeData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    sysexchangeSystemData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    queryLabelTree: {
      type: Array,
      default: () => {
        return [];
      }
    }
  },
  filters: {},
  data() {
    return {
      noRelease: false,
      isRelease: false,
      filterText: "",
      inComponent: "ShowTable"
    };
  },
  created() {},
  mounted() {},
  methods: {
    // 搜索
    catalogSearch() {
      this.$refs.tree.filter(this.filterText);
    },
    // 树过滤
    treefilter(value, data) {
      if (!value) return true;
      return data.name.indexOf(value) !== -1;
    },
    // 树懒加载
    loadNode(node, resolve) {
      this.$emit("loadNode", node, resolve);
    },
    // 树点击
    nodeClick(data) {
      this.$emit("nodeClick", data);
    },
    // -------------------------------- SystemForm方法
    // 编辑系统
    sysEdit() {
      this.$emit("sysEdit");
    },
    // 关闭编辑弹窗接口
    sysClose() {
      this.$emit("sysClose");
    },
    // 取消编辑弹窗接口
    sysCancel() {
      this.$emit("sysCancel");
    },
    // 确定弹窗接口
    sysKeep() {
      this.$emit("sysKeep");
    },
    // ----------------------------------InfoCollect
    // 编辑
    baseInfoEdit() {
      this.$emit("baseInfoEdit");
    },
    // 关闭弹窗
    baseInfoClose() {
      this.$emit("baseInfoClose");
    },
    // 取消弹窗
    baseInfoCancel() {
      this.$emit("baseInfoCancel");
    },
    // 保存弹窗
    baseInfoKeep() {
      this.$emit("baseInfoKeep");
    },
    // 数据库类型联动数据库版本
    baseSearchDbVersion(val) {
      this.$emit("baseSearchDbVersion", val);
    },
    // 数据库版本联动数据库驱动
    baseSearchDbDrive(val) {
      this.$emit("baseSearchDbDrive", val);
    }
  },
  destroyed() {}
};
</script>
<style lang="less" scoped>
@import url("./maintenance");
</style>